



// DOM
// 查找
var myList = document.getElementById('myList');
if (!myList.hasAttribute('name')) {
    myList.setAttribute('name', 'test');
}
console.log(myList);

var lists = document.getElementsByTagName('ul');
console.log(lists);

// 创建元素
var a = document.createElement('a');
a.innerHTML = "百度";
a.href = "http://www.baidu.com/";
a.style.cssText = "color: red; display: block";

// 添加到DOM树
var body = document.getElementsByTagName('body');
body[0].appendChild(a)
